//
// Created by jiao on 2021/4/19.
//

#ifndef NATIVEHANDLERDEMO_YHHANDLER_H
#define NATIVEHANDLERDEMO_YHHANDLER_H
#include <android/log.h>
#include "jni.h"

//日志开关
#define YH_HANDLER_DEBUG

#ifdef YH_HANDLER_DEBUG
#define YQ_HANDLER_LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "yh_handler_native", __VA_ARGS__)
#define YH_HANDLER_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "yh_handler_native", __VA_ARGS__)
#endif

#ifndef YH_HANDLER_DEBUG
#define YQ_HANDLER_LOGD(...)
#define YH_HANDLER_LOGE(...)
#endif


typedef int (YqHandlerCallBackFunc)(int ident, void *data);

class YHHandler {
public:

    virtual void sendMessage(int ident, void *data) = 0;

    virtual void removeMessage(int ident) = 0;

    virtual void removeAll() = 0;

    virtual void quit() = 0;

};

YHHandler *YHHandler_create(bool isMain,YqHandlerCallBackFunc *callBack);

void YHHandler_destroy(YHHandler *);


#endif //NATIVEHANDLERDEMO_YHHANDLER_H
